<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <script>
        // 展开运算符 ...
        let arr = [10,1,2,6];
        // max方法 需要的参数是数字  传递 arr 无法计算
        console.log(Math.max(arr))

        console.log(Math.max(arr[0],arr[1],arr[2],arr[3]));
        // 展开 平铺 ...arr 就等价于写arr[0],arr[1],arr[2],arr[3]
        console.log(Math.max(...arr))


        let obj = {
            name:'abc',
            age:20
        }
        let obj2={
            // 等价于 将obj变量对应的属性 全部转移过来 
            // name:'abc',
            // age:20
            ...obj,
            height:180
        }
        // console.log(obj)
        // console.log(obj2)
        // obj2.forEach(function(item,key){
        //     console.log(item);

        // })
        for(key in obj2){
            console.log(key)
        }
        Object.assign(obj2)
    </script>
</body>
</html>   